package org.example.library;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;
import java.util.ArrayList;

public class RestauranteItemizedOverlay extends ItemizedOverlay{
    
    private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
    Context mContext;
    int id;
    Activity actividad;
    Class<?> dactividad;
    String usuario;
    
    public RestauranteItemizedOverlay(Drawable defaultMarker) {
        super(boundCenterBottom(defaultMarker));
    }
    
    public void addOverlay(OverlayItem overlay) {
        mOverlays.add(overlay);
        populate();
    }
    
    public RestauranteItemizedOverlay(Drawable defaultMarker, Context context,int id, Activity act, Class<?> dact,String usu) {
        super(boundCenterBottom(defaultMarker));
        mContext = context;
        this.id = id;
        actividad = act;
        dactividad = dact;
        usuario = usu;
    }

    @Override
    protected OverlayItem createItem(int i) {
        return mOverlays.get(i);
    }

    @Override
    public int size() {
        return mOverlays.size();
    }
    
    @Override
    protected boolean onTap(int index) {
        Intent i=new Intent(actividad, dactividad);
        i.putExtra("id",id);
        i.putExtra("usuario",usuario);
        actividad.startActivity(i);
        return true;
    }
    
}
